package java3_14;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class JavaTestClass {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        JavaClass jc=new JavaClass();
        System.out.println("新班开班");
        jc.name="java83";
        jc.manageTeacher="李老师";
        jc.dirTeacher="老刘";
        jc.startDate="2023-2-20";
        int choice=0;
        while (true){
            System.out.println("1:加新人，2：查看班级情况,3:查找,4:范围查找,5:查找指定位置学生,6:修改学生姓名,9：退出");
            choice=in.nextInt();
            if(choice==1){
                System.out.print("请输入新人的名字：");
                String name=in.next();
                jc.add(name);
            }else if(choice==2){
                jc.selfIntro();
            }else if(choice==3){
                System.out.println("找谁？");
                String name=in.next();
                boolean insresult = jc.search(name);
                System.out.println(insresult?"这个人在这个班":"查无此人！");
            }else if (choice==4){
                System.out.println("找谁？,初始值,结束值");
                String name=in.next();
                int start = in.nextInt();
                int end = in.nextInt();
                boolean insresult2 = jc.search2(name,start,end);
                System.out.println(insresult2?"这个人在这个班":"查无此人！");
            }else if (choice==5){
                System.out.println("请输入要查找学生的姓名和位置：");
                String name = in.next();
                int index = in.nextInt();
                String result = jc.find(index,name);
                System.out.println(result);
            }else if(choice==6){
                System.out.println("请输入要修改的学生姓名:");
                String oldName = in.next();
                System.out.println("请输入修改后的姓名:");
                String newName = in.next();
                boolean result = jc.change(oldName,newName);
                System.out.println("修改的结果为："+result);
            }else if(choice==9){
                break;
            }
        }
    }
}
